#!/bin/bash
#  

L_number=0
e_number=0
while read line; do
      state=$(echo $line | awk '{print $6}')
      if [ $state == "LISTEN" ]; then
          let l_number++
      elif [ $state == "ESTABLISHED" ]; then
        let e_number++
      fi
done < <(netstat -antp |sed '1,2d')
echo "监听:$l_number,建立连接:$e_number"

